﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace HamcoWcs.DAL.Migrations
{
    public partial class A15 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<DateTime>(
                name: "CompleteTime",
                table: "sub_task",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<DateTime>(
                name: "StartTime",
                table: "sub_task",
                type: "datetime(6)",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AlterColumn<string>(
                name: "UnitId",
                table: "main_task",
                type: "varchar(100)",
                maxLength: 100,
                nullable: false,
                comment: "条码号",
                oldClrType: typeof(string),
                oldType: "varchar(30)",
                oldMaxLength: 30,
                oldComment: "条码号")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<DateTime>(
                name: "StartTime",
                table: "main_task",
                type: "datetime(6)",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "datetime(6)",
                oldComment: "开始时间");

            migrationBuilder.AlterColumn<DateTime>(
                name: "CompleteTime",
                table: "main_task",
                type: "datetime(6)",
                nullable: false,
                oldClrType: typeof(DateTime),
                oldType: "datetime(6)",
                oldComment: "完成时间");

            migrationBuilder.AddColumn<string>(
                name: "InventoryInfo",
                table: "main_task",
                type: "text",
                maxLength: 100,
                nullable: true,
                comment: "盘点信息")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "MaterialInfo",
                table: "main_task",
                type: "text",
                maxLength: 100,
                nullable: true,
                comment: "物料信息")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "Path",
                table: "main_task",
                type: "varchar(200)",
                maxLength: 200,
                nullable: true,
                comment: "路径")
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AddColumn<string>(
                name: "TransactionId",
                table: "main_task",
                type: "varchar(20)",
                maxLength: 20,
                nullable: true,
                comment: "MES下发任务是的TransactionId")
                .Annotation("MySql:CharSet", "utf8mb4");
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropColumn(
                name: "CompleteTime",
                table: "sub_task");

            migrationBuilder.DropColumn(
                name: "StartTime",
                table: "sub_task");

            migrationBuilder.DropColumn(
                name: "InventoryInfo",
                table: "main_task");

            migrationBuilder.DropColumn(
                name: "MaterialInfo",
                table: "main_task");

            migrationBuilder.DropColumn(
                name: "Path",
                table: "main_task");

            migrationBuilder.DropColumn(
                name: "TransactionId",
                table: "main_task");

            migrationBuilder.AlterColumn<string>(
                name: "UnitId",
                table: "main_task",
                type: "varchar(30)",
                maxLength: 30,
                nullable: false,
                comment: "条码号",
                oldClrType: typeof(string),
                oldType: "varchar(100)",
                oldMaxLength: 100,
                oldComment: "条码号")
                .Annotation("MySql:CharSet", "utf8mb4")
                .OldAnnotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.AlterColumn<DateTime>(
                name: "StartTime",
                table: "main_task",
                type: "datetime(6)",
                nullable: false,
                comment: "开始时间",
                oldClrType: typeof(DateTime),
                oldType: "datetime(6)");

            migrationBuilder.AlterColumn<DateTime>(
                name: "CompleteTime",
                table: "main_task",
                type: "datetime(6)",
                nullable: false,
                comment: "完成时间",
                oldClrType: typeof(DateTime),
                oldType: "datetime(6)");
        }
    }
}
